﻿function showdiv(){
    document.getElementById("div5").style.display='block';
}

function register() {//注册页面
    var NA = document.getElementById("user2").value;
    var PASSWORD = document.getElementById("pass2").value;
    var CONFIRM = document.getElementById("confirm").value;
    var EMAIL = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
    var emAIL = document.getElementById("email").value;


    //判断注册页面信息是否填写正确
    if (NA.length == 0) {
        $('#user2').attr("placeholder","请输入正确用户名")
    }else if(NA.length>20||NA.length<3){
        $('#user2').attr("placeholder","用户名只能是3~20位")
    }
    if (PASSWORD.length == 0) {
        $('#pass2').attr("placeholder","请输入密码")
    }
    if (CONFIRM.length == 0) {
       $('#confirm').attr("placeholder","请确认密码")
    }else if(CONFIRM!=PASSWORD){
        $('#confirm').attr("placeholder","确保两次输入的密码一致")
    }
    if (emAIL.length == 0) {
       $('#email').attr("placeholder","请输入正确的电子邮件地址")
    }else if (EMAIL.test(emAIL)){
    }else{
        $('#email').attr("placeholder","不要输入奇怪的东西")
    }

    if(
        NA.length!=0
        &&PASSWORD.length!=0
        &&CONFIRM.length!=0
        &&EMAIL.length!=0) {


    localStorage["NAME"]=NA;

    localStorage["passWORD"]=PASSWORD;

    localStorage["eMAIL"]=emAIL;


        window.open("456.html", "_blank", "height=420,width=520,location=no,scrollbars=no,status=no,titlebar=no,fullscreen=yes")


    }
    }
function login(){//验证登录
    var a  = document.getElementById("user").value;
    var b  = document.getElementById("pass").value;
    var c  = localStorage["NAME"];
    var e  = localStorage["passWORD"];
    if(a==c&&b==e&&a!=0&&b!=0){
        alert("登录成功");
        location.href='../1.html';
    }else{
        alert("用户名或密码错误");
    }

}


function lll(){//用户协议
    var z = localStorage["NAME"]
    if(z==null){
        alert("不要单独点开我，快去注册")
    }else{
        alert("注册成功")
        window.close();
    }
}
var s = 4 ;
function countsub(){//用户协议
    var btnReg = document.getElementById("btnReg");
    if(btnReg){
        if(s<0){
            btnReg.value="同意";
            btnReg.disabled=false;
            clearInterval(id);
        }else{
            btnReg.value="请仔细思考(还剩"+s+"秒)";
            s--;
        }
    }
}
var id = setInterval('countsub()',1000);

function CodeFind(){//找回密码
    var z = document.getElementById("eee").value;
    var x = localStorage["eMAIL"];
    var c = document.getElementById("yhm").value;
    var v = localStorage["NAME"]
    if(z==x&&c==v){
        alert("您的密码为："+localStorage["passWORD"])
    }else{
        alert("注册信息不符合，你的密码找不回来了")
    }

}
